/*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    COPYRIGHT NARESHKUMAR RAO 2009-2010

*/

var JSHP = new Object();

JSHP.get = function(vname, ucd)
{

var getStr = String( document.location );
getStr = getStr.substring( getStr.indexOf("?") + 1, getStr.length);

var getParse = getStr.split("&");

var getVars = new Array();

for( var c = 0; c < getParse.length; c++)
{

var tempParse = getParse[c].split("=");

getVars[ tempParse[0] ] = getParse[c].substring( tempParse[0].length + 1, getParse[c].length);

}

if(String(getVars[vname])=="undefined")
{

getVars[vname]="error(0x000001)";

}





if(ucd==true)
{
return unescape(getVars[vname]);
}else if(ucd==false){
return getVars[vname];
}else{
return unescape(getVars[vname]);
}

}

JSHP.echo = function(etxt)
{

return document.write(etxt);

}

JSHP.setCookie = function(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

JSHP.readCookie = function(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

JSHP.browser = function()
{

if(navigator.userAgent.match("Firefox"))
{
return "Mozilla Firefox";
}else if(navigator.userAgent.match("MSIE"))
{
return "Internet Explorer";
}else if(navigator.userAgent.match("Opera"))
{
return "Opera"
}else if(navigator.userAgent.match("Safari"))
{
return "Safari";
}else if(navigator.userAgent.match("iPod") || navigator.userAgent.match("iPhone"))
{

return "iPhone/iPod";

}else{
return "Unknown Browser"
}

}
